<?php
switch ($a) {
    case 'login':
        do_login(I('userName'), I('password'));
        die('<script>location.reload();</script>');
        break;
    case 'login_out':
        do_login_out();
        die('<script>location.href="index.php";</script>');
        break;
}
?>
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
<head>
    <title>Login</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <style type="text/css">
        html { font-size: 12px; }
        form, li, ul { margin: 0px; }
        li { list-style: none; }
        .copyright { margin-top: 10px; color: #666; }
    </style>
</head>
<body>
<fieldset>
    <legend>Login</legend>
    <form action="#" method="post">
        <ul>
            <li>
                <label>用户名：</label>
                <input type="text" name="userName" placeholder="请输入用户名" title="请填写用户名" required/>
            </li>
            <li>
                <label>密码：</label>
                <input type="password" name="password" placeholder="请输入密码" title="请填写密码" required/>
            </li>
            <li>
                <label>&nbsp;</label>
                <input type="submit" value="登录"/><input type="reset" value="重置"/>
            </li>
        </ul>
        <input type="hidden" name="a" value="login"/>
    </form>
</fieldset>
<div class="copyright">(c) 2014 XCall</div>
</body>
</html>